﻿package config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091900547262";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCsjKCkN07d1hlV/HRq19WT9ZsE5JC4XUfcus1Rl8gMZLok4MCUeGedlLdGpSXZXzPdLOfGOzuCwNJh36Byyy66T3eNJPIoHhlqJl0uRuDr7a/ajle7PUWXvUZV4mh9jnm+frrFYC0/6Wf8nr9vjKZvvzsSh7YGzdkMvw1s0AP/MssN2KrtJ0M33RaFzQldHyQbsbtjmCQ3+UL8MD/OOeVzJdggI6bUu6uAgXBli+dU4Vd9jvm+3dbf2YxB4D7e2PfQBsNOYeUijQSnN1iWv9DwjXCWRh2bOmK4NYY4GOCRMhKXR5b1XWhqDiN0SOJdj6znFaORWoeDaDtZILsZHZ8XAgMBAAECggEAb19RrM0aNaukrNCHYBMyAw+LYIwbMTTcVoeoUNr0P7OgRn9fLjXNQ3QjHBEqrfR6KG98poHC9rF42b2a9Z1Z6t2yH8NSHjzXUKG0kVMkiIPhduNbkzqIOdnslTDPGwOkZyWrbgyXCGKiQPdCP0D8iLJY8avw/NFPIKAMjUhy2/ue/qtPMGHTBk+vArExpPi9DO6eLyIUTkQ4+OsBf8iHu0hs7bTdCQbM3Ot+hIbAyD+kKOTpebghAiIC96sI+XLxT8cdo8Ip/rTiOhXHWk+lwapzDTAyxP3RBINJdFgO/Lq6CsliVJhxHuHQueOrjHsw8QN6SAcLKbBuF31ow7FrSQKBgQDq6+qTeYA930ARhxMfmgOc5s134CH79a1sTXgT7sxdMnPnuHgQ5J7doeW8xm9o8rop3f08hTvDmw2nmHOlaISwTQPShIkvKCEHWRqDD4ve9xr6tQbWQeJ2v+jjgbYpntr0zymXuKnhz1aVld8JXB05qahSm1GVnPhFL40OlXF3ZQKBgQC8CAnPXSIjOTASZctYtcLHA3AUTGHFnIhNJZ1RFLbgs635TOdzy0H1Dp2Rq6GHrddW6wLsy4cgwbsnNDrUwWcy7M00GqiFdg/sPr81hbVF76RPuBAOZlhpcoPULTRwp86neH19HClpbSWXcdQXcqkxWh9Xm+iYtyT8f8t1XPIKywKBgAamPNKFyuJ1cjvMxfbMBjQnuEMfXfbiwlDhdHej97bfmbZCW2um/PQrA/Su7TJcRHaw6N0QrFtiBSXsQ8G3zqGq3GPWCogCK8UoeX6iLwRVnDbibtobrUxNLEtcPYq6C1qIjpXTzUMt+jZrso9yQwWBztjfupRwh/p1WRnDkx2dAoGALViO7RhbzDzVcApmkN08vPwCQpLtHVgTsu84Uj55oBUVBsNaKh3BqVS+AUxv5yWwggCpMuweiXLPLLQ23+pIdgqPrlojfBQt4N59BG5beiNB8AvGq4JZHg0E592DAQwnFVJEiTCKeCdfYneMG5+GWCWQ23L5FCNO4yn6qjIhGSMCgYEAtqlvtGywHMqIvaLmcVqw1YKuSlQ66XhxAryz/t5xC5HzrXBMyXR86bhAb/HONJySA87aJIC7jYJS5vzoBPzOiISwFUh1+OobrtF5R+ONOivDN6mDQirMyXKhYlPa66vMBEF0au1ixchqTIUE07yav4IvUKg7VKlUEaUCezCoGmM=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCfauwst2eYVbYF69o85QmUMLvPVypBemDV9KiITVqo+K297U67oSTTpth12WZEYmBWBniwHeeJiWRNhuTzr3evmq3Gq4LkyYuXSuqgecdb9zvRpI/i0Y3DRhA4a9szXKhYu60RfNYqNedVOcSBUIGsmL+XhsLGavYQ8Fo/iFx6+jHRBd+o6n08C86H8NwwohCmNTAP8vlVluzLQCRH3GX1uttedC6z8wo2NfbQJyKN1W8PRPuy2K1c2w+8CtYB9n0I7AeWt34+Qb/BBJk2y51ubf9EptVBeptsXSD/j0+DhIS/7XJme+cyPfsjgXVFBqLQAKahJXMLBBMpHHisehwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://ktjy.mynatapp.cc/pay-servlet-demo/aliPayNotifyUrlServlet";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://ktjy.mynatapp.cc/pay-servlet-demo/aliPayReturnUrlServlet";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

